
<?php include ADMIN_INCLUDE_DIR."/header.php";?>
<script type="text/javascript" language="javascript">
    function delProperty(params,text){
        confirm_get("Bạn chắc chắn muốn xóa "+text+"?",'<?php echo ADMIN_URL;?>'+params);
    }

    function multiPropertyAction(action){
        objForm = $("#formPropertyView");
        switch (action) {
            case 'delete':
                $("#formPropertyViewAction").val('delete');
                confirm_post("Bạn có chắc chắn muốn xóa bản ghi đã chọn?",'formPropertyView');
                break;
            case 'actived':
                $("#formPropertyViewAction").val('actived');
                objForm.submit();
                break;
            case 'closed':
                $("#formPropertyViewAction").val('closed');
                objForm.submit();
                break;
            case 'pending':
                $("#formPropertyViewAction").val('pending');
                objForm.submit();
                break;           
            case 'front_page':
                $("#formPropertyViewAction").val('front_page');
                objForm.submit();
                break;
        }

    }
</script>
<div class="container_l">
    <div class="title_user"><img src="images/icon4.gif" />Danh sách sản phẩm</div>
    <div class="table_user">

        <?php
        show_error();
        show_success();
        ?>
        <div class="spacer1"><span></span></div>
        <fieldset>
            <legend accesskey="N">Tìm kiếm sản phẩm</legend>
            <form name="formPropertySearch" method="get" action="">
                <div class="lineaddnew">
                    <div class="lineform">
                        <div class="divlabel">Từ khóa:</div>
                        <div class="divform">
                            <input type="hidden" name="module" value="property"/>
                            <input type="text" name="keyword" value="<?php echo stripcslashes(htmlentities_utf8($_REQUEST['keyword']));?>"/>
                        </div>
                    </div>
                    <div class="lineform">
                        <div class="divlabel">Danh mục:</div>
                        <div class="divform">
                            <select name="cat_id">
                                <option value="0">Tất cả</option>
                                <?php
                                $arrPropertyCat = listAllPropertyCategory($parent_id = 0);
                                for($i=0;$i<count($arrPropertyCat);$i++) {
                                    ?>
                                <option <?php echo setSelectedBoxValue($_REQUEST['cat_id'], $arrPropertyCat[$i]['cat_id']);?> value="<?php echo $arrPropertyCat[$i]['cat_id'];?>"><?php echo $arrPropertyCat[$i]['cat_title'];?></option>
                                <?php
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="linesubmit">
                        <input type="submit" name="submitFrmPropertySearch" value="Tìm kiếm" class="button" />
                    </div>
                    <div class="spacer1"><span></span></div>
                </div>
            </form>
        </fieldset>
        <div class="spacer1"><span></span></div>
        <form id="formPropertyView" method="post" action="">
            <div class="table_user_in">
                <div class="boxtitle">
                    <div class="d_input">
                        <input type="checkbox" name="checkall" id="checkall" value="" />
                        <input type="hidden" id="formPropertyViewAction" name="formPropertyViewAction" value=""/>
                        <input type="hidden" id="action" name="action" value="multiAction"/>
                    </div>
                    <div class="d_title">Tiêu đề</div>
                    <div class="d_cate">Danh mục</div>
                    <div class="d_statusnews">Trạng thái</div>
                    <div class="d_datetime">Ngày tạo</div>
                    <div class="d_setting">Thao tác</div>
                </div>
                <?php
                $rsProperty = listAllProperty();
                if($db->num_rows($rsProperty['rs'])) {
                    while($rs=$db->fetch_array($rsProperty['rs'])) {
                        ?>
                <div class="lineuser">
                    <div class="d_input2"><input type="checkbox" name="arr_property_id[]" class="check" value="<?php echo $rs['id'];?>" /></div>
                    <div class="d_title2"><font class="textbody"><a href="?module=property&action=detail&id=<?php echo $rs['id'];?>&keepThis=true&TB_iframe=true&height=580&width=480" class="thickbox" title="<?php echo htmlentities($rs['title'], ENT_COMPAT, 'UTF-8');?>"><?php echo cutString($rs['title'],86);?></a></font></div>
                    
                    <div class="d_cate2"><font class="textbody"><a href="?module=property&keyword=&cat_id=<?php echo $rs['cat_id'];?>&submitFrmPropertySearch=Search"><?php echo $rs['cat_title'];?></a></font></div>
                    <div class="d_statusnews2"><?php echo showStatus($rs['status']);?></div>
                    <div class="d_datetime2"><font class="textbody"><?php echo date('d/m/Y',strtotime($rs['create_date']));?></font></div>
                    <div class="d_setting2"><a href="<?php echo get_string_url(array('action','id'));?>&action=edit&id=<?php echo $rs['id'];?>"><img src="images/edit.gif" alt="Edit" title="Edit" /></a><a href="javascript: delProperty('?module=property&action=del&page=<?php echo $rsProperty['page'];?>&id=<?php echo $rs['id'];?>','<?php echo htmlentities($rs['title'], ENT_COMPAT, 'UTF-8');?>')"><img src="images/delete.gif" alt="Delete" title="Delete" /></a></div>
                </div>
                    <?php
                    }
                    ?>
                <div class="boxbutton">
                    <input type="button" onclick="javascript: multiPropertyAction('actived');" value="Kích hoạt" class="button" />
                    <input type="button" onclick="javascript: multiPropertyAction('pending');" value="Hủy kích hoạt" class="button" />
                    <input type="button" onclick="javascript: multiPropertyAction('closed');" value="Hết hàng" class="button" />
                    <input type="button" onclick="javascript: multiPropertyAction('delete');" value="Xóa mục đã chọn" class="button" />
                </div>
                    <?php paging($rsProperty['page'], $rsProperty['totalPages'], get_string_url());?>

                <?php }?>
            </div>
        </form>
    </div>
</div>

<?php
include "inc/right.php";
include ADMIN_INCLUDE_DIR."/footer.php";
?>